package edu.sctu.practice.class02.Wangpeng.Assign09;

/**
 * Created by wp on 2015/12/10.
 */
public class sort_Demo {
    int i, j, k, swap;

    sort_Demo() {
       i = j = k = swap = 0;
       }


    void sort(int t1, int t2[]) {
        for (i = 0; i < t1 - 1; i++) {
            k = i;
            for (j = i + 1; j < t1; j++)
            if (t2[j] < t2[k]) k = j;
            if (k != i) {
                swap = t2[i];
                t2[i] = t2[k];
                t2[k] = swap;
                }
         }
        }
}

class sub_sort_Demo extends sort_Demo {

    void sort(int t1, int t2[]) {
        for (i = 0; i < t1 - 1; i++) {
        k = i;
        for (j = i + 1; j < t1; j++)
        if (t2[j] > t2[k]) k = j;
        if (k != i) {
            swap = t2[i];
            t2[i] = t2[k];
            t2[k] = swap;}
        }
    }


}




